<template>
  <div class="reject-node" :class="{ selected: selected }">
    <div class="node-content">
      <el-icon class="node-icon"><Close /></el-icon>
      <div class="node-text">
        <div class="node-title">{{ data?.name || '驳回' }}</div>
        <div class="node-subtitle">
          {{ getRejectTargetText() }}
        </div>
      </div>
    </div>
    <Handle
      id="target"
      type="target"
      :position="Position.Left"
      :style="{ background: '#f56c6c' }"
    />
  </div>
</template>

<script setup lang="ts">
import { Handle, Position } from '@vue-flow/core'
import { ElIcon } from 'element-plus'
import { Close } from '@element-plus/icons-vue'

const props = defineProps({
  id: String,
  data: Object,
  selected: Boolean
})

const getRejectTargetText = () => {
  const target = props.data?.rejectTarget
  if (!target) {
    return '请选择驳回目标'
  }
  return `驳回至: ${target.name}`
}

defineOptions({
  name: 'RejectNode'
})
</script>

<style scoped>
.reject-node {
  padding: 12px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
  color: white;
  min-width: 140px;
  border: 2px solid transparent;
  transition: all 0.3s ease;
  position: relative;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.reject-node.selected {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3), 0 8px 24px rgba(239, 68, 68, 0.4);
  transform: scale(1.02);
}

.reject-node:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4);
}

.node-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.node-icon {
  font-size: 22px;
  color: white;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.node-text {
  flex: 1;
}

.node-title {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
  letter-spacing: 0.3px;
}

.node-subtitle {
  font-size: 11px;
  opacity: 0.9;
  margin-top: 3px;
  font-weight: 400;
}
</style> 